package cz.muni.fi.heathrow.dao;

import cz.muni.fi.heathrow.entities.Destination;
import cz.muni.fi.heathrow.exceptions.ServiceFailureException;
import java.util.List;

/**
 *
 * @author Martin Zitnik
 */
public interface DestinationDAO {
    
    /**
     * Stores destination to datastore and assign id.
     * 
     * @param destination Destination to be stored.
     * @throws IllegalArgumentException when destination is null or has set id parameter.
     * @throws ServiceFailureException on datastore failure.
     */
    public void createDestination(Destination destination);
    
    
    /**
     * Returns persisted Destination.
     * 
     * @param id Id of Destination to be found in datastore.
     * @throws IllegalArgumentException when destination is null or hasn't set id parameter.
     * @throws ServiceFailureException on datastore failure.
     * @return Persisted destination.
     */
    public Destination getDestination(Long id);
    
    /**
     * Save updated destination to datastore.
     * 
     * @param destination Destination to be updated.
     * @throws IllegalArgumentException when destination is null or hasn't set id parameter.
     * @throws ServiceFailureException on datastore failure.
     */
    public void updateDestination(Destination destination);
    
    /**
     * Delete destination from datastore
     * 
     * @param destination Destination to be deleted.
     * @throws IllegalArgumentException when destination is null or hasn't set id parameter.
     * @throws ServiceFailureException on datastore failure.
     */
    public void deleteDestination(Destination destination);
    
    
    /**
     * Find all destination.
     * 
     * @return list of all destinations
     * @throws ServiceFailureException  on datastore failure.
     */
    public List<Destination> findAll();
    
    
    
    public List<Destination> findDestinationWild(String text, int limit);
    
}